import api from '../utils/http.js'
import global from "../config/global"
export default {
    listDir(dir) {
        return api.get("/api/file/listFile", { "parentPath": dir })
    },
    listMark() {
        return api.get("/api/file/listMark")
    },
    markFile(dir, isMark) {
        return api.post("/api/file/mark", { "mark": isMark, "file": dir })
    },
    downloadFile(dir) {
        return global.BASE_URL+"/api/res/download?&path=" + dir
    },
    deleteFile(dir){
        return api.post("/api/res/delete", { "file": dir })
    },
    getFileContent(dir){
        return api.post("/api/res/getFileContent", { "file": dir })
    },
    setFileContent(dir,newConetent){
        return api.post("/api/res/setFileContent", { "file": dir ,"content":newConetent})
    },
    uploadFile(file,callback){
        return api.postForm("/api/res/upload", file,callback)
    }

}